home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 August: Tool Chest / Dev.CD Aug 00 TC Disk 1.toast / pc / sample code / graphics 2d / rotatestring / rotatesamplemain.c next >
Encoding:
C/C++ Source or Header  |  2000-06-23  |  2.3 KB  |  86 lines

  1. /*
  2.     File:        rotateSampleMain.c
  3.  
  4.     Contains:    
  5.  
  6.     Written by: Randy Theland and Brigham Stevens    
  7.  
  8.     Copyright:    Copyright © 1992-1999 by Apple Computer, Inc., All Rights Reserved.
  9.  
  10.                 You may incorporate this Apple sample source code into your program(s) without
  11.                 restriction. This Apple sample source code has been provided "AS IS" and the
  12.                 responsibility for its operation is yours. You are not permitted to redistribute
  13.                 this Apple sample source code as "Apple sample source code" after having made
  14.                 changes. If you're going to re-distribute the source, we require that you make
  15.                 it clear in the source that the code was descended from Apple sample source
  16.                 code, but that you've made changes.
  17.  
  18.     Change History (most recent first):
  19.                 7/14/1999    Karl Groethe    Updated for Metrowerks Codewarror Pro 2.1
  20.                 
  21.  
  22. */
  23. #include <Fonts.h>
  24. #include <Events.h>
  25. #include <Windows.h>
  26. #include <Menus.h>
  27. #include <TextEdit.h>
  28. #include <Dialogs.h>
  29.  
  30. #include "RotateString.h"
  31.  
  32. #define    NIL_POINTER            0L
  33. #define REMOVE_ALL_EVENTS    0
  34. #define VISIBLE                true
  35. #define    MOVE_TO_FRONT        (Ptr)-1
  36. #define HAS_GOAWAY            true
  37. void    main()
  38. {
  39.     WindowPtr    window1,window2;
  40.     BitMap        destMap;
  41.     Rect        windowRect;
  42.     
  43.     InitGraf( &qd.thePort);
  44.     InitFonts();
  45.     FlushEvents( everyEvent, REMOVE_ALL_EVENTS);
  46.     InitWindows();
  47.     InitMenus();
  48.     TEInit();
  49.     InitDialogs( NIL_POINTER);
  50.     InitCursor();
  51.  
  52.     
  53.     
  54.     SetRect( &windowRect, 100, 100, 200, 200);
  55.     
  56.     window1 = NewWindow( NIL_POINTER, &windowRect, "\pCounter CW", VISIBLE,
  57.                 noGrowDocProc,(WindowPtr)-1, HAS_GOAWAY, NIL_POINTER);
  58.  
  59.     SetPort(window1);
  60.     TextFont(4);
  61.     //TextFace(bold+italic);
  62.     TextSize(96);
  63.     
  64.     RotateString( "\pRotatey", &destMap, counterClockWise);
  65.     SizeWindow(window1,destMap.bounds.right,destMap.bounds.bottom,false);
  66.  
  67.     CopyBits( &destMap, &window1->portBits, &destMap.bounds,
  68.              &destMap.bounds, srcCopy, NIL_POINTER);
  69.     
  70.     OffsetRect(&windowRect,(windowRect.right - windowRect.left ) + 40,0);
  71.     window2 = NewWindow( NIL_POINTER, &windowRect, "\pClock Wise", VISIBLE,
  72.                 noGrowDocProc,(WindowPtr) MOVE_TO_FRONT, HAS_GOAWAY, NIL_POINTER);
  73.  
  74.     SetPort(window2);
  75.     TextFont(4);
  76.     //TextFace(bold+italic);
  77.     TextSize(96);
  78.     
  79.     RotateString( "\pRotate", &destMap, clockWise);
  80.     SizeWindow(window2,destMap.bounds.right,destMap.bounds.bottom,false);
  81.  
  82.     CopyBits( &destMap, &window2->portBits, &destMap.bounds,
  83.              &destMap.bounds, srcCopy, NIL_POINTER);
  84.  
  85.     while( !Button());
  86. }